From 763c04b3186a6fd878be6535e6d854a2c1236038 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 4 Jul 2005 16:02:46 +0000 Subject: [PATCH] Rename fields in physinfo_t structure and add sockets/nodes fields. --- tools/python/xen/lowlevel/xc/xc.c | 29 ++++++++++++++++++----------- tools/python/xen/xend/XendNode.py | 4 ++-- tools/xentrace/xentrace.c | 5 ++++- xen/arch/x86/dom0_ops.c | 13 ++++++++----- xen/include/public/dom0_ops.h | 8 +++++--- 5 files changed, 37 insertions(+), 22 deletions(-) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 89035c12be..dbd8c06b5a 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -47,7 +47,8 @@ static PyObject *pyxc_domain_dumpcore(PyObject *self, static char *kwd_list[] = { "dom", "corefile", NULL }; - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list, &dom, &corefile) ) + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list, + &dom, &corefile) ) goto exit; if ( (corefile == NULL) || (corefile[0] == '\0') ) @@ -82,7 +83,8 @@ static PyObject *pyxc_domain_create(PyObject *self, static char *kwd_list[] = { "dom", "ssidref", NULL }; - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list, &dom, &ssidref)) + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list, + &dom, &ssidref)) return NULL; if ( (ret = xc_domain_create(xc->xc_handle, ssidref, &dom)) < 0 ) @@ -687,11 +689,13 @@ static PyObject *pyxc_physinfo(PyObject *self, return PyErr_SetFromErrno(xc_error); return Py_BuildValue("{s:i,s:i,s:l,s:l,s:l}", - "ht_per_core", info.ht_per_core, - "cores", info.cores, - "total_pages", info.total_pages, - "free_pages", info.free_pages, - "cpu_khz", info.cpu_khz); + "threads_per_core", info.threads_per_core, + "cores_per_socket", info.cores_per_socket, + "sockets_per_node", info.sockets_per_node, + "nr_nodes", info.nr_nodes, + "total_pages", info.total_pages, + "free_pages", info.free_pages, + "cpu_khz", info.cpu_khz); } static PyObject *pyxc_sedf_domain_set(PyObject *self, @@ -702,12 +706,15 @@ static PyObject *pyxc_sedf_domain_set(PyObject *self, u32 domid; u64 period, slice, latency; u16 extratime, weight; - static char *kwd_list[] = { "dom", "period", "slice", "latency", "extratime", "weight",NULL }; + static char *kwd_list[] = { "dom", "period", "slice", + "latency", "extratime", "weight",NULL }; - if( !PyArg_ParseTupleAndKeywords(args, kwds, "iLLLhh", kwd_list, &domid, - &period, &slice, &latency, &extratime, &weight) ) + if( !PyArg_ParseTupleAndKeywords(args, kwds, "iLLLhh", kwd_list, + &domid, &period, &slice, + &latency, &extratime, &weight) ) return NULL; - if ( xc_sedf_domain_set(xc->xc_handle, domid, period, slice, latency, extratime,weight) != 0 ) + if ( xc_sedf_domain_set(xc->xc_handle, domid, period, + slice, latency, extratime,weight) != 0 ) return PyErr_SetFromErrno(xc_error); Py_INCREF(zero); diff --git a/tools/python/xen/xend/XendNode.py b/tools/python/xen/xend/XendNode.py index d915f0ba0f..2d62f12f4e 100644 --- a/tools/python/xen/xend/XendNode.py +++ b/tools/python/xen/xend/XendNode.py @@ -43,8 +43,8 @@ class XendNode: def physinfo(self): pinfo = self.xc.physinfo() - info = [['cores', pinfo['cores']], - ['hyperthreads_per_core', pinfo['ht_per_core']], + info = [['cores_per_socket', pinfo['cores_per_socket']], + ['threads_per_core', pinfo['threads_per_core']], ['cpu_mhz', pinfo['cpu_khz']/1000], ['memory', pinfo['total_pages']/256], ['free_memory', pinfo['free_pages']/256]] diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c index 50988c90f8..f8236a22e0 100644 --- a/tools/xentrace/xentrace.c +++ b/tools/xentrace/xentrace.c @@ -273,7 +273,10 @@ unsigned int get_num_cpus() xc_interface_close(xc_handle); - return op.u.physinfo.ht_per_core * op.u.physinfo.cores; + return (op.u.physinfo.threads_per_core * + op.u.physinfo.cores_per_socket * + op.u.physinfo.sockets_per_node * + op.u.physinfo.nr_nodes); } diff --git a/xen/arch/x86/dom0_ops.c b/xen/arch/x86/dom0_ops.c index 7ca358d69b..ff606ca1c7 100644 --- a/xen/arch/x86/dom0_ops.c +++ b/xen/arch/x86/dom0_ops.c @@ -179,11 +179,14 @@ long arch_do_dom0_op(dom0_op_t *op, dom0_op_t *u_dom0_op) { dom0_physinfo_t *pi = &op->u.physinfo; - pi->ht_per_core = smp_num_siblings; - pi->cores = boot_cpu_data.x86_num_cores; - pi->total_pages = max_page; - pi->free_pages = avail_domheap_pages(); - pi->cpu_khz = cpu_khz; + pi->threads_per_core = smp_num_siblings; + pi->cores_per_socket = boot_cpu_data.x86_num_cores; + pi->sockets_per_node = + num_online_cpus() / (pi->threads_per_core * pi->cores_per_socket); + pi->nr_nodes = 1; + pi->total_pages = max_page; + pi->free_pages = avail_domheap_pages(); + pi->cpu_khz = cpu_khz; copy_to_user(u_dom0_op, op, sizeof(*op)); ret = 0; diff --git a/xen/include/public/dom0_ops.h b/xen/include/public/dom0_ops.h index 255e098e1a..19ad0efab5 100644 --- a/xen/include/public/dom0_ops.h +++ b/xen/include/public/dom0_ops.h @@ -19,7 +19,7 @@ * This makes sure that old versions of dom0 tools will stop working in a * well-defined way (rather than crashing the machine, for instance). */ -#define DOM0_INTERFACE_VERSION 0xAAAA1009 +#define DOM0_INTERFACE_VERSION 0xAAAA100A /************************************************************************/ @@ -206,8 +206,10 @@ typedef struct { */ #define DOM0_PHYSINFO 22 typedef struct { - u32 ht_per_core; - u32 cores; + u32 threads_per_core; + u32 cores_per_socket; + u32 sockets_per_node; + u32 nr_nodes; u32 cpu_khz; memory_t total_pages; memory_t free_pages; -- 2.30.2